<template>
	<div>
		<div class="loan_nav">
			<ul>
				<li>
					<a href="javascript:history.go(-1)">
						<i class="iconfont">&#xe61e;</i>
					</a>
				</li>
				<li>
					<p>失信黑名单</p>
				</li>
				<li></li>
			</ul>
		</div>
		<div class="interval_T">

		</div>
		<div>
			<swiper :list="imgList" :show-dots="false" loop auto :aspect-ratio="0.3" dots-position="center" dots-class="custom-bottom"></swiper>
		</div>
		<div class="creditinquiry_form">
			<ul>
				<li>
					<x-input v-model="params.name" placeholder="姓名" readonly></x-input>
				</li>
			</ul>
			<ul>
				<li>
					<x-input v-model="params.ID" placeholder="身份证号" readonly></x-input>
				</li>
			</ul>
		</div>

		<div @click="query" class="creditinquiry_btn">
			<input type="button" value="查询">
		</div>

		<div v-if="list.length !== 0" class="Result">
			<p>查询结果：</p>
			<div v-for="s in list">
				<ul>
					<li><p>编号：</p></li>
					<li><p>{{s.code}}</p></li>
				</ul>
				<ul>
					<li><p>法院：</p></li>
					<li><p>{{s.court}}</p></li>
				</ul>
				<ul>
					<li><p>中断类型：</p></li>
					<li><p>{{s.disrupt_type}}</p></li>
				</ul>
				<ul>
					<li><p>责任：</p></li>
					<li><p>{{s.duty}}</p></li>
				</ul>
				<ul>
					<li><p>履行：</p></li>
					<li><p>{{s.performance}}</p></li>
				</ul>
				<div style="height:0.2rem;background:rgb(251, 249, 254)">

				</div>
			</div>
		</div>
	</div>
</template>
<script>
import { XInput } from 'vux'
export default {
	components: {
		XInput
	},
	data() {
		return {
			params: {},
			list: [],

			imgList: []
		}
	},
	created() {
		this.queryImg()
		this.queryMember()
	},
	methods: {
		queryMember() {
			this.$http.get('/app/member/userInfo').then(json => {
				const { code, user } = json
				if(code === 0) {
					if(!user.cardNo) this.$vux.toast.show({ type: 'cancel', text: '实名认证后方可使用' })
					this.$set(this.params, 'name', user.memberName)
					this.$set(this.params, 'ID', user.cardNo)
				}
			})
		},
		query() {
			this.$http.get('/app/aliApi/dishonest', {
				params: this.params
			}).then(json => {
				const { code, list } = json
				if(code === 0) {
					if(list.length === 0) return this.$vux.toast.show({ text: '没有失信数据' })
					this.list = list
				}
			})
		},

		queryImg() {
			this.$http.get('/app/index/carousel', {
				params: { page: 'blacklist' }
			}).then(json => {
				const { code, carousel } = json
				if (code === 0) {
					carousel.forEach(n => {
						this.imgList.push({
							url: n.url,
							img: n.imgPath
						})
					})
				}
			})
		}
	}
}
</script>
<style>
.creditinquiry_form .weui-cell {
  padding: 0;
}
.creditinquity_mark .weui-cell {
  padding: 0;
}
.creditinquiry_last .vux-x-input-right-full img,
.creditinquiry_last .vux-x-input-right-full {
  height: 30px;
}
</style>
